package com.example.myglidedemo.options;

import android.content.Context;

import androidx.annotation.NonNull;

import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.load.engine.cache.LruResourceCache;
import com.bumptech.glide.module.AppGlideModule;


// 重新配置Glide 的默认配置项
@GlideModule
public class MyAppGlideModule extends AppGlideModule {

    @Override
    public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
        // 重新配置最大缓存
        int memoryCacheSizeBytes = 1024*1024*20;//20mb
        builder.setMemoryCache(new LruResourceCache(memoryCacheSizeBytes));
    }
}
